@extends('layout.main')
@section('content')
<div class="col-sm-9 blog-main">
    <div>
        <div id="carousel-example" class="carousel slide" data-ride="carousel" >
            <!-- Indicators -->
            <ol class="carousel-indicators"></ol><!-- Wrapper for slides -->
            <div class="carousel-inner">
                <div class="item active">
                    <img src="http://dmmylove.cn/img/slide/2.jpg" alt="...">
                </div>
                <div class="item">
                    <img src="http://dmmylove.cn/img/slide/2.jpg" alt="...">
                </div>
            </div><!-- Controls -->
             <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
          </a>
          <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
          </a>
        </div>
    </div>

    <div style="height: 20px;"></div>
    <div>
        @foreach($posts as $post)
        <div class="blog-post">
            <h2 class="blog-post-title">
                <a href="/posts/{{$post->id}}">{{$post->title}}</a>
            </h2>
            <p class="blog-post-meta">
                {{--date('M d,Y',strtotime($post->created_at)) laravel所有模型返回的的时间都是carbon对象返回的--}} {{$post->created_at->toFormattedDateString()}} by <a href="/user/5">{{$post->user->name}}</a>
            </p>
            <p>{!!$post->content!!}</p>
            <p class="blog-post-meta">
                赞 {{$post->likes_count}} | 评论 {{$post->comments_count}}
            </p>
        </div>
        @endforeach
        {{ $posts->links() }}
    </div><!-- /.blog-main -->
</div>
@endsection


    